﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Pibby.Core.Tests
{
	[TestClass]
	public class WhuffieTests
	{
		[TestMethod]
		public void CheckInitialConditions()
		{
			Whuffie w = new Whuffie();

			Assert.AreEqual(0, w.Score);
		}

		//[TestMethod]
		//public void DifferentScoresAreNotEqual()
		//{
		//    Whuffie high = new Whuffie();
		//    Whuffie low = new Whuffie();

		//    high.Esteem();

		//    Assert.IsTrue(high.CompareTo(low) > 0);
		//}

		[TestMethod]
		public void EsteemIncreasesScore()
		{
			Whuffie w = new Whuffie();

			int originalValue = w.Score;

			w.Esteem();

			Assert.AreEqual(originalValue + 1, w.Score);

			w.Esteem(9);

			Assert.AreEqual(originalValue + 10, w.Score);
		}

		[TestMethod]
		public void ExpendingWhuffieLowersScore()
		{
			Whuffie w = new Whuffie();
			w.Esteem(100);

			int originalValue = w.Score;

			w.Expend();

			Assert.AreEqual(originalValue - 1, w.Score);

			w.Expend(10);

			Assert.AreEqual(originalValue - 11, w.Score);
		}

		[TestMethod]
		public void CannotExpendBelowZero()
		{
			Whuffie w = new Whuffie();
			w.Esteem(1);

			Assert.AreEqual(1, w.Score);

			w.Expend();
			Assert.AreEqual(0, w.Score);

			w.Expend();
			Assert.AreEqual(0, w.Score);

			w.Expend(10);
			Assert.AreEqual(0, w.Score);
		}
	}

}
